interface State {
  isAuthenticated: boolean;
}

interface Action {
  type: string;
  payload: boolean;
}

/**
 * https://blog.logrocket.com/react-usereducer-hook-ultimate-guide/
 * @param state
 * @param action
 * @returns
 */
export default function authenticationReducer(_state: State, action: Action) {
  switch (action.type) {
    case 'change':
      return { isAuthenticated: action.payload };
    default:
      throw new Error();
  }
}
